﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.system.attend
{
    public partial class duty_interval : ModulePage 
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                AttendParaDao dao = new AttendParaDao();
                dao.GetPara();
                this.txtBefore1.Value = dao.DutyIntervalBefore1.ToString();
                this.txtAfter1.Value = dao.DutyIntervalAfter1.ToString();
                this.txtBefore2.Value = dao.DutyIntervalBefore2.ToString();
                this.txtAfter2.Value = dao.DutyIntervalAfter2.ToString();
            }
            if (this.Page.IsPostBack)
            {
                this.pnlMain.Visible = false;
                AttendParaDao dao2 = new AttendParaDao();
                dao2.DutyIntervalBefore1 = Convert.ToInt32(this.txtBefore1.Value);
                dao2.DutyIntervalAfter1 = Convert.ToInt32(this.txtAfter1.Value);
                dao2.DutyIntervalBefore2 = Convert.ToInt32(this.txtBefore2.Value);
                dao2.DutyIntervalAfter2 = Convert.ToInt32(this.txtAfter2.Value);
                dao2.SetInterval(base.Conn);
                base.CloseConn();
                Response.Redirect("index.aspx");
            }
        } 

    }
}
